package com.cli.springboottemplateengine.service;

import com.cli.springboottemplateengine.engine.TemplateEngineRegistry;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class TemplateRenderService {

    private final TemplateEngineRegistry engineRegistry;

    public TemplateRenderService(TemplateEngineRegistry registry) {
        this.engineRegistry = registry;
    }

    public String render(String type, String template, Map<String, Object> model) {
        return engineRegistry.getEngine(type).render(template, model);
    }
}

